<?php

namespace app\api\controller;


use app\api\lists\game\GameLists;
use app\api\logic\GameLogic;

/**
 * 游戏管理
 * Class GameController
 * @package app\api\controller
 */
class GameController extends BaseApiController
{

    public array $notNeedLogin = [];


    /**
     * @notes 游戏列表
     * @return \think\response\Json
     * @author 段誉
     * @date 2024/8/1 15:30
     */
    public function lists()
    {
        return $this->dataLists(new GameLists());
    }


    /**
     * @notes 游戏详情
     * @return \think\response\Json
     * @author 段誉
     * @date 2022/9/20 17:09
     */
    public function detail()
    {
        $id = $this->request->get('id/d');
        $result = GameLogic::detail($id);
        return $this->data($result);
    }


    /**
     * @notes 根据id集合获取游戏信息
     * @return \think\response\Json
     * @author 段誉
     * @date 2022/9/20 17:09
     */
    public function getGameByIds()
    {
        $ids = $this->request->post('ids/s');
        if(empty($ids)){
            $result = [];
        }else{
            $ids_arr = explode(',', $ids);
            $result = GameLogic::getGameByIds($ids_arr);
        }
        return $this->data($result);
    }



}